<template>
    <div class="content">
        <h1 class="text-center">临时工</h1>
        <el-row :gutter="20" class="mt30">
            <el-col :span="12">项目名称：{{ project.title }}</el-col>
            <el-col :span="12" class="text-right">合同完工期{{ project.end_date }}</el-col>
        </el-row>
        <el-table class="mt20" show-summary :data="tableData" :border="true" style="width: 100%">
            <el-table-column type="index" :index="indexMethod" label="序号" width="60" />
            <el-table-column prop="created_at" label="日期" />
            <el-table-column prop="name" label="姓名" />
            <el-table-column prop="mobile" label="联系电话" />
            <el-table-column prop="age" label="年龄" />
            <el-table-column prop="work" label="工种" />
            <el-table-column prop="work_time" label="工作时间" />
            <!-- <el-table-column prop="start_date" label="入场时间" />
            <el-table-column prop="end_date" label="出场时间" /> -->
            <el-table-column prop="quantity" label="数量" />
            <el-table-column prop="unit" label="单位" />
            <el-table-column prop="basic_salary" label="单价" />
            <el-table-column prop="total_price" label="总价" />
            <el-table-column prop="pay" label="已支付" />
            <el-table-column prop="no_pay" label="未支付费用" />
            <el-table-column prop="region" label="施工区域（具体数据）" />
            <el-table-column prop="price" label="备注" />
        </el-table>
    </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import http from '../../../../util/request';
const indexMethod = (index: number) => {
  return index += 1
}
let project:any = sessionStorage.getItem('project')
project = JSON.parse(project)
const form = ref<any>({search:'',page:0,current:0,total:10,limit:20,loading:false,parentBorder:false})
const tableData = ref<any[]>([])

const onGetData = () => {
    
    form.value.loading = true
    tableData.value = []
    http.post('/labourer/costs',form.value).then((response:any)=>{
        form.value.loading = false
        tableData.value = response.data.data
        form.value.total = response.data.total
    })
}

onMounted(()=>{
    onGetData()
})
</script>

<style scoped>

</style>